/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package vn.ac.c0910g.assignment.Entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author BachLe
 */
@Entity
@Table(name = "Services")
@NamedQueries({
    @NamedQuery(name = "Services.findAll", query = "SELECT s FROM Services s"),
    @NamedQuery(name = "Services.findByServicesID", query = "SELECT s FROM Services s WHERE s.servicesID = :servicesID"),
    @NamedQuery(name = "Services.findByServicesName", query = "SELECT s FROM Services s WHERE s.servicesName = :servicesName"),
    @NamedQuery(name = "Services.findByImagesSmall", query = "SELECT s FROM Services s WHERE s.imagesSmall = :imagesSmall"),
    @NamedQuery(name = "Services.findByDesription", query = "SELECT s FROM Services s WHERE s.desription = :desription"),
    @NamedQuery(name = "Services.findByPriceServices", query = "SELECT s FROM Services s WHERE s.priceServices = :priceServices"),
    @NamedQuery(name = "Services.findByUnit", query = "SELECT s FROM Services s WHERE s.unit = :unit"),
    @NamedQuery(name = "Services.findByVisiable", query = "SELECT s FROM Services s WHERE s.visiable = :visiable")})
public class Services implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ServicesID")
    private Integer servicesID;
    @Basic(optional = false)
    @Column(name = "ServicesName")
    private String servicesName;
    @Column(name = "ImagesSmall")
    private String imagesSmall;
    @Basic(optional = false)
    @Column(name = "Desription")
    private String desription;
    @Basic(optional = false)
    @Lob
    @Column(name = "ServicesDetails")
    private String servicesDetails;
    @Basic(optional = false)
    @Column(name = "PriceServices")
    private Integer priceServices;
    @Column(name = "Unit")
    private String unit;
    @Column(name = "Visiable")
    private Integer visiable;
    @JoinColumn(name = "CategoryID", referencedColumnName = "CategoryID")
    @ManyToOne(optional = false)
    private Category category;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "services")
    private List<OrderDetails> orderDetailsList;

    public Services() {
    }

    public Services(Integer servicesID) {
        this.servicesID = servicesID;
    }

    public Services(Integer servicesID, String servicesName, String desription, String servicesDetails, Integer priceServices) {
        this.servicesID = servicesID;
        this.servicesName = servicesName;
        this.desription = desription;
        this.servicesDetails = servicesDetails;
        this.priceServices = priceServices;
    }

    public Integer getServicesID() {
        return servicesID;
    }

    public void setServicesID(Integer servicesID) {
        this.servicesID = servicesID;
    }

    public String getServicesName() {
        return servicesName;
    }

    public void setServicesName(String servicesName) {
        this.servicesName = servicesName;
    }

    public String getImagesSmall() {
        return imagesSmall;
    }

    public void setImagesSmall(String imagesSmall) {
        this.imagesSmall = imagesSmall;
    }

    public String getDesription() {
        return desription;
    }

    public void setDesription(String desription) {
        this.desription = desription;
    }

    public String getServicesDetails() {
        return servicesDetails;
    }

    public void setServicesDetails(String servicesDetails) {
        this.servicesDetails = servicesDetails;
    }

    public Integer getPriceServices() {
        return priceServices;
    }

    public void setPriceServices(Integer priceServices) {
        this.priceServices = priceServices;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public Integer getVisiable() {
        return visiable;
    }

    public void setVisiable(Integer visiable) {
        this.visiable = visiable;
    }

    public Category getCategory() {
        return category;
    }

    public void setCategory(Category category) {
        this.category = category;
    }

    public List<OrderDetails> getOrderDetailsList() {
        return orderDetailsList;
    }

    public void setOrderDetailsList(List<OrderDetails> orderDetailsList) {
        this.orderDetailsList = orderDetailsList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (servicesID != null ? servicesID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Services)) {
            return false;
        }
        Services other = (Services) object;
        if ((this.servicesID == null && other.servicesID != null) || (this.servicesID != null && !this.servicesID.equals(other.servicesID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "vn.ac.c0910g.assignment.DAO.Services[servicesID=" + servicesID + "]";
    }

}
